<template>
  <ul  class="todo-list">
    <!-- completed: 完成的类名 -->
    <li :class="{'completed':item.isDone}" v-for="item in $store.getters.cut" :key="item.id">
      <div class="view">
        <input
         :checked="item.isDone"
         @change="changeAll(item.id)"
         class="toggle" type="checkbox" />
        <label>{{item.name}}</label>
        <button class="destroy" @click="del(item.id)"></button>
      </div>
    </li>
  </ul>
  
</template>

<script>
export default {
  
  updated(){
    localStorage.setItem('list',JSON.stringify(this.$store.state.list))
  },
  methods:{
    del(id){
      this.$store.commit('del',id)
    },
    changeAll(id){
      this.$store.commit('changeAll',id)
     },
    }
  }

</script>